<?php
function ParseXml($strHtml)
{
    $arrConfig = array
    (
        "indent"           => True,
        "output-xml"       => True,
        "wrap"             => 2000,
        "doctype"          => "omit",
        "quote-ampersand"  => False,
        "clean"            => True,
        "drop-empty-paras" => True,
        "quote-nbsp"       => False
    );
    $oTidy = new tidy;
    $oTidy->parseString($strHtml, $arrConfig, "utf8");
    $oTidy->cleanRepair();
    $oXml = simplexml_load_string($oTidy);
    return $oXml;
}

?>